#ifndef RESMAN_H
#define RESMAN_H

#include "main_inc.h"
#include "clog.h"
#include "SDL.h"
#include "sdl_rotozoom.h"
#include "SDL_ttf.h"
#include "object.h"


#define RTYPE_GRAPHICS      0x01
#define RTYPE_SOUND         0x02
#define RTYPE_GRAPHICS360   0x03

struct Resource
{

    i32 hash;
    string org_name;
    u32 type;
};

struct Graphics : public Resource
{
    Graphics()
    {
        type = RTYPE_GRAPHICS;
    }
    Sprite spr;
};

struct Graphics360 : public Resource
{
    Graphics360()
    {
        type = RTYPE_GRAPHICS360;
    }
    Sprite360 spr;
};

struct Sound : public Resource
{
    // add later
};

#define RES (Resman::getResman())

class Resman
{
protected:
        Resman();
        static Resman *global;
    public:
        static Resman* getResman();

        virtual ~Resman();

        i32 LoadLiveObject(string f_name, string res_name, i32 frames);
        i32 LoadStaticAnim( string f_name, string res_name, i32 frames);
        i32 LoadAnimFromSheet(string f_name, string res_name, i32 st_x, i32 st_y, i32 w, i32 h, i32 frames);
        i32 LoadStatic(string f_name, string res_name, i32 non_alfa = 0);
        i32 Load360Object(string f_name, string res_name);

        static i32 HASH(string text);
        Resource * GET(string text);
        i32 Remove(string text);


    protected:

        vector<Resource*> _resources;

    private:
};

#endif // RESMAN_H
